package main

import (
	"fmt"
	"slices"
)

func reverseStr(s string, k int) string {
	bArray := []byte(s)
	// 商
	num := len(s) / (2 * k)
	// 余数
	remainder := len(s) % (2 * k)

	for i := 0; i < num; i++ {
		slices.Reverse(bArray[i*2*k : i*2*k+k])
	}

	if remainder < k {
		slices.Reverse(bArray[num*2*k:])
	} else if remainder >= k {
		slices.Reverse(bArray[num*2*k : num*2*k+k])
	}
	return string(bArray)
}
func main() {
	fmt.Println(reverseStr("1234567890", 2))
}
